package com.dreamer.service.pyramid;

import com.dreamer.domain.account.AccountsName;
import com.dreamer.domain.user.AccountsRecord;
import com.dreamer.repository.account.AccountsNameDAO;
import com.dreamer.repository.account.AccountsRecordDAO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import ps.mx.otter.utils.SearchParameter;

import java.util.List;

@Service
public class AccountsRHandler {

    @Autowired
    private AccountsRecordDAO accountsRecordDAO;

    @Transactional
    public AccountsRecord saveOrupdate(AccountsRecord paramConfig){
        AccountsRecord instance = accountsRecordDAO.merge(paramConfig);
        return instance;
    }

    @Transactional
    public void remove(AccountsRecord paramConfig) {
        accountsRecordDAO.delete(paramConfig);
    }

    public AccountsRecord findById(Integer integer) {
        return  accountsRecordDAO.findById(integer);
    }

    public List<AccountsRecord> searchAllByPage(SearchParameter<AccountsRecord> parameter) {
        return accountsRecordDAO.searchAllByPage(parameter);
    }

    public List<AccountsRecord> findAll(){
        return accountsRecordDAO.findAll();
    }

}
